#pragma once
#include <iostream>

#define Die(code)   \
    do              \
    {               \
        exit(code); \
    } while (0);

enum err{
    USE_ERR,
    SOCK_ERR,
    BIND_ERR,
};

#define CONV(v) (struct sockaddr*)(v)

bool SplitLine( const std::string   &line, 
                std::string         *key, 
                std::string         *value,
                const std::string   &delimiter)
{
    size_t pos = line.find(delimiter);
    if(pos == std::string::npos) return false;
    *key = line.substr(0, pos);
    *value = line.substr(pos + delimiter.size(), std::string::npos);
    if(key->empty() || value->empty()) return false;
    return true;
}

